package com.itheima.controller;/**
 *
 */

import com.itheima.domain.User;
import com.itheima.factory.UserFactory;

/**
 * @ClassName TestDemo03
 * @Description TODO
 *  @Author $无小白$
 *  @Date 2020/8/24 23:21
 *  @Version 1.0
 **/
public class TestDemo03 {


    public void testFactory(){
        //创建工厂对象
        UserFactory userFactory = new UserFactory();
        //利用工厂对象调用他的构造方法
        User user1 = userFactory.getUser1();
        user1.eat();


        /*把工厂静态*/
        User user = UserFactory.getUser();
        user.eat();


    }
}
